/**
 * 分享配置
 */
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { wxshareConfig } from '../interface/interface';

export const share = function (args: wxshareConfig = {}) {
    const defaultWxShareConfig: wxshareConfig = {
        ...args,
    };
    const sapp = (args: wxshareConfig = {}) => {
        onShareAppMessage(() => {
            return { ...defaultWxShareConfig, ...args };
        });
    };
    const sTimeline = (args: wxshareConfig = {}) => {
        onShareTimeline((args: wxshareConfig = {}) => {
            return { ...defaultWxShareConfig, ...args };
        });
    };

    return {
        onShareAppMessage: sapp,
        onShareTimeline: sTimeline,
    };
};
